<?php
defined('IN_IXDCW') or exit('Access Denied');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=<?php echo DT_CHARSET;?>"/>
    <title>管理中心 - <?php echo $DT['sitename']; ?></title>
    <link rel="stylesheet" href="admin/image/style.css" type="text/css"/>
	<?php if (!DT_DEBUG) { ?>
    <script type="text/javascript">window.onerror = function () {
        return true;
    }</script><?php } ?>
	<script src="<?php echo PUBLIC_URL;?>Js/global.js"></script>
	<script src="<?php echo PUBLIC_URL;?>Js/libs/seajs/2.2.0/seajs.js"></script>
	<script src="<?php echo PUBLIC_URL;?>Js/libs/config.js"></script>
    <script type="text/javascript" src="lang/<?php echo DT_LANG;?>/lang.js"></script>
    <script type="text/javascript" src="file/script/config.js"></script>
    <script type="text/javascript" src="file/script/common.js"></script>
    <script type="text/javascript" src="file/script/admin.js"></script>
    <script type="text/javascript" src="file/script/jquery.js"></script>

    <base target="main"/>
    <!--[if IE]>
	<style type="text/css">html {
		overflow-x: hidden;
		overflow-y: auto;
	}</style>
    <![endif]-->
</head>
<body>
<?php
include DT_ROOT . '/admin/menu.inc.php';
// 普通管理员
if ($_admin == 2) {
	?>
<table cellpadding="0" cellspacing="0" width="<?php echo $DT['admin_left'];?>" height="100%">
    <tr>
        <td id="bar" class="bar" valign="top" align="center">
            <img src="admin/image/bar2on.gif" width="25" height="85"/>
            <img src="admin/image/barnav.gif" width="25" height="1"/>
        </td>
        <td valign="top" class="barmain">
            <div class="bartop">
                <table cellpadding="0" cellspacing="0" width="100%">
                    <tr height="20">
                        <td width="5"></td>
                        <td id="name">我的面板</td>
                        <td width="50" align="right">
                            <a href="./" target="_blank"><img src="admin/image/home.gif" width="8" height="8" title="网站首页"/></a>&nbsp;
                            <a href="?action=start" target="_top"><img src="admin/image/reload.gif" width="8" height="8" title="刷新(返回后台起始页)"/></a>&nbsp;
                            <a href="?file=logout" target="_top" onclick="if(!confirm('确实要注销登录吗?')) return false;"><img src="admin/image/quit.gif" width="8" height="8" title="注销登录"/></a>
                        </td>
                        <td width="5"></td>
                    </tr>
                </table>
            </div>
            <div id="menu">
                <dl>
                    <dt onclick="s(this)" onmouseover="this.className='dt_on';" onmouseout="this.className='';">我的面板</dt>
                    <dd onclick="c(this);"><a href="?action=main">系统首页</a></dd>
                    <dd onclick="c(this);"><a href="?file=mymenu">定义面板</a></dd>
					<?php
					foreach ($mymenu as $menu) {
						?>
                        <dd onclick="c(this);"><a href="<?php echo $menu['url'];?>"><?php echo set_style($menu['title'], $menu['style']);?></a></dd>
						<?php
					}
					?>
                </dl>
            </div>
        </td>
    </tr>
</table>
	<?php } else { ?>
<table cellpadding="0" cellspacing="0" width="<?php echo $DT['admin_left'];?>" height="100%">
    <tr>
        <td id="bar" class="bar" valign="top" align="center" style="padding-top: 20px;">
            <img src="admin/image/bar1on.gif" width="25" height="85" id="b_1" onclick="showMenu(1);"/>
            <img src="admin/image/barnav.gif" width="25" height="1" id="n_1"/>
            <img src="admin/image/bar2.gif" width="25" height="85" id="b_2" onclick="showMenu(2);"/>
            <img src="admin/image/barnav.gif" width="19" height="1" id="n_2"/>
            <img src="admin/image/bar3.gif" width="25" height="85" id="b_3" onclick="showMenu(3);"/>
            <img src="admin/image/barnav.gif" width="19" height="1" id="n_3"/>
            <img src="admin/image/bar4.gif" width="25" height="85" id="b_4" onclick="showMenu(4);"/>
	        <img src="admin/image/barnav.gif" width="19" height="1" id="n_4"/>
	        <img src="admin/image/bar5.gif" width="25" height="85" id="b_5" onclick="showMenu(5);"/>
            <img src="admin/image/barnav.gif" width="19" height="1" id="n_5"/>
	        <img src="admin/image/bar6.gif" width="25" height="85" id="b_6" onclick="showMenu(6);"/>
	        <img src="admin/image/barnav.gif" width="19" height="1" id="n_6"/>
	        <img src="admin/image/bar7.gif" width="25" height="85" id="b_7" onclick="showMenu(7);"/>
	        <img src="admin/image/barnav.gif" width="19" height="1" id="n_7"/>
        </td>
        <td valign="top" class="barmain">
            <div class="bartop">
                <table cellpadding="0" cellspacing="0" width="100%">
                    <tr height="20">
                        <td width="5"></td>
                        <td id="name">&nbsp;</td>
                        <td width="50" align="right">
                            <a href="./" target="_blank"><img src="admin/image/home.gif" width="8" height="8" title="网站首页"/></a>&nbsp;
                            <a href="?action=start" target="_top"><img src="admin/image/reload.gif" width="8" height="8" title="刷新(返回后台起始页)"/></a>&nbsp;
                            <a href="?file=logout" target="_top" onclick="if(!confirm('确实要注销登录吗?')) return false;"><img src="admin/image/quit.gif" width="8" height="8" title="注销登录"/></a>
                        </td>
                        <td width="5"></td>
                    </tr>
                </table>
            </div>
            <div id="showMenu">
	            <div id="m_1">
		            <?php if ($_founder) { ?>
			            <dl>
				            <dt onclick="s(this)" onmouseover="this.className='dt_on';" onmouseout="this.className='';">系统设置</dt>
				            <?php
				            foreach ($menu_system as $m) {
					            echo '<dd onclick="c(this);"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
				            }
				            ?>
				            <?php if ($_founder) { ?>
					            <dd onclick="c(this);"><a href="?action=clear_cache">清空缓存</a></dd>
					            <!--
								<dd onclick="c(this);"><a href="?file=html" onclick="return confirm('确定要开始更新全站页面吗？此操作比较耗费服务器资源和时间 ');">更新全站</a></dd>
					            -->
				            <?php } ?>
			            </dl>
		            <?php } ?>
		            <dl>
			            <dt onclick="s(this)" onmouseover="this.className='dt_on';" onmouseout="this.className='';">系统工具</dt>
			            <?php
			            foreach ($menu as $m) {
				            echo '<dd onclick="c(this);"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
			            }
			            ?>
		            </dl>
	            </div>
	            <div id="m_2">
		            <dl>
			            <?php
			            if (!empty($menu_help)) {
				            foreach ($menu_help as $m) {
					            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
				            }
			            }
			            ?>
		            </dl>
		            <dl>
			            <dt onclick="s(this)" onmouseover="this.className='dt_on';" onmouseout="this.className='';">我的面板</dt>
			            <dd onclick="c(this);"><a href="?action=main">系统首页</a></dd>
			            <dd onclick="c(this);"><a href="?file=mymenu">定义面板</a></dd>
			            <?php
			            foreach ($mymenu as $menu) {
				            ?>
				            <dd onclick="c(this);"><a href="<?php echo $menu['url'];?>"><?php echo set_style($menu['title'], $menu['style']);?></a></dd>
			            <?php
			            }
			            ?>
		            </dl>
	            </div>
	            <div id="m_3">
		            <?php
		            $menuinc = DT_CORE . '/' . $MODULE[3]['module'] . '/admin/menu.inc.php';
		            if (is_file($menuinc)) {
			            extract($MODULE[3]);
			            include $menuinc;
			            echo '<dl id="dl_' . $moduleid . '">';
			            echo '<dt onclick="m(' . $moduleid . ');" onmouseover="this.className=\'dt_on\';" onmouseout="this.className=\'\';">扩展功能</dt>';
			            foreach ($menu as $m) {
				            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
			            }
			            echo '</dl>';
		            }
		            ?>
		            <?php
		            foreach ($MODULE as $v) {
			            if ($v['cat'] == 'info') {
				            $menuinc = DT_CORE . '/' . $v['module'] . '/admin/menu.inc.php';
				            if (is_file($menuinc)) {
					            extract($v);
					            include $menuinc;
					            echo '<dl id="dl_' . $moduleid . '">';
					            echo '<dt onclick="m(' . $moduleid . ');" onmouseover="this.className=\'dt_on\';" onmouseout="this.className=\'\';">' . $name . '管理</dt>';
					            foreach ($menu as $m) {
						            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
					            }
					            echo '</dl>';
				            }
			            }
		            }
		            ?>
		            <dl>
			            <dt onclick="s(this)" onmouseover="this.className='dt_on';" onmouseout="this.className='';">合作商家</dt>
			            <dd onclick="c(this)" style="display: none;">
				            <a href="?moduleid=2&file=business_auth">商家会员</a>
			            </dd>
			            <dd onclick="c(this)" style="display: none;">
				            <a href="?moduleid=2&file=business">店铺列表</a>
			            </dd>
			            <dd onclick="c(this)" style="display: none;">
				            <a href="?moduleid=2&file=business_picture">图片管理</a>
			            </dd>
			            <dd onclick="c(this)" style="display: none;">
				            <a href="?file=category&mid=33">商家分类</a>
			            </dd>
		            </dl>
	            </div>
	            <div id="m_4">
		            <?php
		            $menuinc = DT_CORE . '/' . $MODULE[2]['module'] . '/admin/menu.inc.php';
		            if (is_file($menuinc)) {
			            extract($MODULE[2]);
			            include $menuinc;
			            echo '<dl id="dl_' . $moduleid . '">';
			            echo '<dt id="dt_' . $moduleid . '" onclick="s(this);" onmouseover="this.className=\'dt_on\';" onmouseout="this.className=\'\';">' . $name . '管理</dt>';
			            foreach ($menu as $m) {
				            echo '<dd onclick="c(this);"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
			            }
			            echo '</dl>';
		            }
		            ?>
		            <?php
		            $menuinc = DT_CORE . '/' . $MODULE[4]['module'] . '/admin/menu.inc.php';
		            if (is_file($menuinc)) {
			            extract($MODULE[4]);
			            include $menuinc;
			            echo '<dl id="dl_' . $moduleid . '">';
			            echo '<dt id="dt_' . $moduleid . '" onclick="s(this);;h(Dd(\'dt_pay\'));;h(Dd(\'dt_oth\'));" onmouseover="this.className=\'dt_on\';" onmouseout="this.className=\'\';">' . $name . '管理</dt>';
			            foreach ($menu as $m) {
				            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
			            }
			            echo '</dl>';
		            }
		            ?>
		            <?php
		            $menuinc = DT_CORE . '/' . $MODULE[37]['module'] . '/admin/menu.inc.php';
		            if (is_file($menuinc)) {
			            extract($MODULE[37]);
			            include $menuinc;
			            echo '<dl id="dl_' . $moduleid . '">';
			            echo '<dt id="dt_' . $moduleid . '" onclick="s(this);;h(Dd(\'dt_pay\'));;h(Dd(\'dt_oth\'));" onmouseover="this.className=\'dt_on\';" onmouseout="this.className=\'\';">' . $name . '管理</dt>';
			            foreach ($menu as $m) {
				            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
			            }
			            echo '</dl>';
		            }
		            ?>
		            <dl id="dl_pay">
			            <dt id="dt_pay" onclick="s(this);h(Dd('dt_oth'));h(Dd('dt_4'));" onmouseover="this.className='dt_on';" onmouseout="this.className='';">财务管理</dt>
			            <?php
			            foreach ($menu_finance as $m) {
				            echo '<dd onclick="c(this);"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
			            }
			            ?>
		            </dl>
		            <dl id="dl_oth">
			            <dt id="dt_oth" onclick="s(this);h(Dd('dt_pay'));h(Dd('dt_4'));" onmouseover="this.className='dt_on';" onmouseout="this.className='';">会员相关</dt>
			            <?php
			            foreach ($menu_relate as $m) {
				            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
			            }
			            ?>
		            </dl>
	            </div>
	            <div id="m_5">
		            <!-- 这里是车型库的配置 -->
		            <?php
		            include DT_CORE . '/auto/admin/menu_ext.inc.php';
		            echo '<dl id="dl_28_extfield">';
		            echo '<dt onclick="s(this);" onmouseover="this.className=\'dt_on\';" onmouseout="this.className=\'\';">扩展字段</dt>';
		            foreach ($menuExtFields as $m) {
			            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
		            }
		            echo '</dl>';
		            echo '<dl id="dl_28_extRank">';
		            echo '<dt onclick="s(this);" onmouseover="this.className=\'dt_on\';" onmouseout="this.className=\'\';">分级管理</dt>';
		            foreach ($menuExtRank as $m) {
			            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
		            }
		            echo '</dl>';
		            ?>
		            <?php
		            foreach ($MODULE as $v) {
			            if ($v['cat'] == 'car') {
				            $menuinc = DT_CORE . '/' . $v['moduledir'] . '/admin/menu.inc.php';
                                if (is_file($menuinc)) {
					            extract($v);
					            include $menuinc;
					            echo '<dl id="dl_' . $moduleid . '">';
					            echo '<dt onclick="s(this);" onmouseover="this.className=\'dt_on\';" onmouseout="this.className=\'\';">' . $name . '管理</dt>';
					            foreach ($menu as $m) {
						            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
					            }
					            echo '</dl>';
				            }
			            }
		            }
		            ?>
	            </div>
	            <div id="m_6">
		            <ul id="autoTree"></ul>
		            <script>
			            seajs.use(['$', 'easyui','easyui-css'], function($){
				            $(function(){
					            $('#autoTree').tree({
						            url:'<?php echo ajaxUrl('auto/rankTree', 'pid=0'); ?>',
						            onBeforeExpand:function(node){
							            $('#autoTree').tree('options').url = '<?php echo ajaxUrl('auto/rankTree', 'pid='); ?>' + node.attributes.id
						            },
						            onClick:function(node){
							            if (node.attributes.ltype == 'brand') {
								            top.frames['main'].location='?moduleid=29&arbid='+node.attributes.id;
							            } else if (node.attributes.ltype == 'manufactor') {
								            top.frames['main'].location='?moduleid=29&armid='+node.attributes.id;
							            } else if (node.attributes.ltype == 'car') {
								            top.frames['main'].location='?moduleid=29&arcid='+node.attributes.id;
							            }

						            }
					            });
				            })
			            })
		            </script>
	            </div>
	            <div id="m_7">
		            <!-- 这里是摇奖的配置 -->
		            <?php
		            foreach ($MODULE as $v) {
			            // 这里是摇奖
			            if ($v['cat'] == 'ernie') {
				            $menuinc = DT_CORE . '/' . $v['module'] . '/admin/menu.inc.php';
				            if (is_file($menuinc)) {
					            extract($v);
					            include $menuinc;
					            echo '<dl id="dl_' . $moduleid . '">';
					            echo '<dt onclick="toggle(this);" onmouseover="this.className=\'dt_on\';" onmouseout="this.className=\'\';">' . $name . '规则管理</dt>';
					            foreach ($menu as $m) {
						            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
					            }
					            echo '</dl>';
					            echo '<dl id="dl_' . $moduleid . '">';
					            echo '<dt onclick="toggle(this);" onmouseover="this.className=\'dt_on\';" onmouseout="this.className=\'\';">' . $name . '日志管理</dt>';
					            foreach ($menuprize as $m) {
						            echo '<dd onclick="c(this);" style="display:none;"><a href="' . $m[1] . '">' . $m[0] . '</a></dd>';
					            }
					            echo '</dl>';
				            }
			            }
		            }
		            ?>
	            </div>
            </div>
        </td>
    </tr>
</table>

<script type="text/javascript">
    function showMenu(ID) {
	    var imgdir = 'admin/image/';
	    $('#bar>img[height!=1]').each(function(i,e){
		   $(e).attr('src', imgdir+'bar'+(i+1)+'.gif');
	    });
		$('#b_'+ID).attr('src', imgdir+'bar'+ID+'on.gif');
	    $('#showMenu > div').hide();
		$('#m_'+ID).show();
    }
    showMenu(2);
</script>
	<?php } ?>
<script type="text/javascript">
    function c(o) {
        var dds = Dd('menu').getElementsByTagName('dd');
        for (var i = 0; i < dds.length; i++) {
            dds[i].className = dds[i] == o ? 'dd_on' : '';
            if (dds[i] == o) o.firstChild.blur();
        }
    }
    function s(o) {
        var dds = o.parentNode.getElementsByTagName('dd');
        for (var i = 0; i < dds.length; i++) {
            dds[i].style.display = dds[i].style.display == 'none' ? '' : 'none';
        }
    }
    function h(o) {
        var dds = o.parentNode.getElementsByTagName('dd');
        for (var i = 0; i < dds.length; i++) {
            dds[i].style.display = 'none';
        }
    }
    function m(ID) {
        var dls = Dd('m_3').getElementsByTagName('dl');
        for (var i = 0; i < dls.length; i++) {
            var dds = Dd(dls[i].id).getElementsByTagName('dd');
            for (var j = 0; j < dds.length; j++) {
                dds[j].style.display = dls[i].id == 'dl_' + ID ? dds[j].style.display == 'none' ? '' : 'none' : 'none';
            }
        }
    }
    function toggle(o) {
        $(o).parent().find('dd').toggle();
    }
</script>
</body>
</html>